﻿using BLL;
using Common;
using Model.CommonEntities;
using Model.StrategyEntities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StockStrategyView.StockTask
{
    class BaseTask
    {
        /// <summary>
        /// 捕捞季节
        /// </summary>
        /// <param name="code">代码</param>
        /// <param name="exchange">市场</param>
        /// <param name="period">所要显示的周期</param>
        /// <param name="type">数据类型，日线，周线，月线</param>
        /// <param name="date">获取数据的起始时间</param>
        /// <returns></returns>
        public static LinearRegressionResult TestData(string code = null, string exchange = null, int period = -1, string type = null, string date = null)
        {
            //string EndDate = date == null ? DateTime.Now.ToString("yyyy-MM-dd") : Convert.ToDateTime(date).ToString("yyyy-MM-dd");
            //if (date == null && Convert.ToUInt32(DateTime.Now.ToString("HHmm")) < 930)
            //{
            //    EndDate = date == null ? DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") : Convert.ToDateTime(date).ToString("yyyy-MM-dd");
            //}
            //string BeginDate = Convert.ToDateTime(EndDate).AddDays(-1450).ToString("yyyy-MM-dd");
            //code = code == null ? "300083" : code;
            //type = type == null ? "1d" : type;
            //period = period == -1 ? 30 : period;
            //exchange = exchange == null ? ".XSHG" : exchange;

            //Dictionary<string, string> dic = new Dictionary<string, string>();
            //dic.Add("code", code + exchange.ToUpper());
            //dic.Add("unit", type);
            //dic.Add("date", BeginDate);
            //dic.Add("end_date", EndDate);
            //dic.Add("fq_ref_date", EndDate);
            //dic.Add("JQUserName", "13052089963");
            //dic.Add("JQPassWord", "yangyanan");
            //SortedList<string, SingleStockStru> stocklist = GetJQData.get_price_period(dic);
            //return AnalysisEngine.LinearRegression(stocklist, period);
            return null;
        }
        
    }
}
